<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Shop extends CI_Controller {
 	public function __construct(){
 		parent::__construct();
 		//连接数据库
 		$this->db = $this->load->database ( "default", TRUE );
 		//读取dilicms的配置属性
 		$this->siteData = $this->db->get($this->db->dbprefix('site_settings'))->row_array();
 		$this->tableName=$this->db->dbprefix('pet_u_m_goods');
 		$this->categoryTableName=$this->db->dbprefix('u_c_category');
 	}
 	public function index()
 	{
 		$data["shop1"]=$this->getshop(); //将二维数组赋值给 data数组 的 info 下标变量
 		$this->load->view('shop',$data);
 	}
 	public function getshop(){
 		$sql="select * from pet_u_m_goods order by id desc limit 6"; //构建SQL
 		$query = $this->db->query($sql); //发送sql字符串，将返回数据(byte)封装为query对象
 		$resData=$query->result_array(); //将query对象封装为二维数组
 		return $resData;
 		//$this->load->view('news',$data);
 		
 	}
 }
